package com.ahpu.jym.messagealert.tools;

import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;
import net.rim.device.api.util.Persistable;

public class OptionsData implements Persistable {

	private static final long ID = 0x25d0c790925cc063L;

	private boolean push = true;
	private int status;
	private int mailstatus;
	private int Hander;
	private int activeCall;
	private int connectVibrate;
	private int disconnectVibrate;
	private int showButton;
	//private int show139;
	private int gomessages;
	private int backlight;
	
	public int getGomessages() {
		return gomessages;
	}

	public void setGomessages(int gomessages) {
		this.gomessages = gomessages;
	}

	public int getBacklight() {
		return backlight;
	}

	public void setBacklight(int backlight) {
		this.backlight = backlight;
	}

//	public int getShow139() {
//		return show139;
//	}
//
//	public void setShow139(int show139) {
//		this.show139 = show139;
//	}

	public int getMailstatus() {
		return mailstatus;
	}

	public void setMailstatus(int mailstatus) {
		this.mailstatus = mailstatus;
	}

	public int getShowButton() {
		return showButton;
	}

	public void setShowButton(int showButton) {
		this.showButton = showButton;
	}

	public boolean isPush() {
		return push;
	}

	public void setPush(boolean push) {
		this.push = push;
	}

	public int getStatus() {
		return status;
	}

	public int getHander() {
		return Hander;
	}

	public int getActiveCall() {
		return activeCall;
	}

	public int getConnectVibrate() {
		return connectVibrate;
	}

	public int getDisconnectVibrate() {
		return disconnectVibrate;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public void setHander(int hander) {
		Hander = hander;
	}

	public void setActiveCall(int activeCall) {
		this.activeCall = activeCall;
	}

	public void setConnectVibrate(int connectVibrate) {
		this.connectVibrate = connectVibrate;
	}

	public void setDisconnectVibrate(int disconnectVibrate) {
		this.disconnectVibrate = disconnectVibrate;
	}

	public void commit() {
		PersistentObject.commit(this);
	}

	public static OptionsData load() {
		PersistentObject persist = PersistentStore
				.getPersistentObject(OptionsData.ID);

		synchronized (persist) {
			if (persist.getContents() == null) {
				persist.setContents(new OptionsData());
				persist.commit();
			}
		}

		return (OptionsData) persist.getContents();
	}
}
